package com.zfx.bean;

import java.lang.reflect.Constructor;

/**
 * 验证合成类 演示
 * spring 源码中 mbd.isSynthetic()的判断合成类
 *  结果：
 *  	com.zfx.bean.SyntheticTest   - 1
 * 		com.zfx.bean.SyntheticTest   - 2
 * 		com.zfx.bean.SyntheticTest$1   - 2  这个类是编译器自动生成的，是合成的类 SyntheticTest$1
 */
public class SyntheticTest {

	public void test1(){
		int i = new InnerSynthetic().i;
	}

	class InnerSynthetic{

		private int i;
		private InnerSynthetic(){

		}
	}

	public static void main(String[] args) {
		System.out.println("---begin------");
		int i = 0;
		Constructor<?>[] constructors = InnerSynthetic.class.getDeclaredConstructors();
		for (Constructor<?> constructor : constructors) {
			i++;
			for (Class<?> parameterType : constructor.getParameterTypes()) {
				System.out.println(parameterType.getTypeName()+"   - " + i);
			}
		}

	}


}
